home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir37 / ushell.zip / SHELL / SH6.C < prev    next >
C/C++ Source or Header  |  1990-02-19  |  4KB  |  115 lines

  1. /* MS-DOS SHELL - Data Declarations
  2.  *
  3.  * MS-DOS SHELL - Copyright (c) 1990 Data Logic Limited and Charles Forsyth
  4.  *
  5.  * This code is based on (in part) the shell program written by Charles
  6.  * Forsyth and is subject to the following copyright restrictions:
  7.  *
  8.  * 1.  Redistribution and use in source and binary forms are permitted
  9.  *     provided that the above copyright notice is duplicated in the
  10.  *     source form and the copyright notice in file sh6.c is displayed
  11.  *     on entry to the program.
  12.  *
  13.  * 2.  The sources (or parts thereof) or objects generated from the sources
  14.  *     (or parts of sources) cannot be sold under any circumstances.
  15.  *
  16.  *    $Header: sh6.c 1.1 90/01/25 13:42:04 MS_user Exp $
  17.  *
  18.  *    $Log:    sh6.c $
  19.  * Revision 1.1  90/01/25  13:42:04  MS_user
  20.  * Initial revision
  21.  * 
  22.  */
  23.  
  24. #include <sys/types.h>
  25. #include <stddef.h>
  26. #include <signal.h>
  27. #include <errno.h>
  28. #include <setjmp.h>
  29. #include <stdlib.h>
  30. #include <limits.h>
  31. #include <unistd.h>
  32. #include "sh.h"
  33.  
  34. char        *Copy_Right1 = "MS-DOS SH Version 1.4\341 (DOS %d.%d)\n";
  35. char        *Copy_Right2 = "Copyright (c) Data Logic Ltd and Charles Forsyth 1990\n";
  36. char        **dolv;        /* Parameter array            */
  37. int        dolc;        /* Number of entries in parameter array    */
  38. int        exstat;        /* Exit status                */
  39. char        gflg;
  40. int        fn_area_number = -1;    /* Next function area number    */
  41. int        talking;    /* interactive (talking-type wireless)    */
  42. int        execflg;    /* Exec mode                */
  43. int        multiline;    /* \n changed to ;            */
  44. int        Current_Event = 0;    /* Current history event    */
  45. int        *failpt;    /* Current fail point jump address    */
  46. int        *errpt;        /* Current error point jump address    */
  47.                 /* Swap mode                */
  48. int        Swap_Mode = SWAP_EXPAND | SWAP_DISK;
  49. Break_C        *Break_List;    /* Break list for FOR/WHILE        */
  50. Break_C        *Return_List;    /* Return list for RETURN        */
  51. Break_C        *SShell_List;    /* SubShell list for EXIT        */
  52. bool        level0 = FALSE;    /* Level Zero flag            */
  53. bool        r_flag = FALSE;    /* Restricted shell            */
  54.                 /* History processing enabled flag    */
  55. bool        History_Enabled = FALSE;
  56. Fun_Ops        *fun_list = (Fun_Ops *)NULL;    /* Function list    */
  57. Save_IO        *SSave_IO;    /* Save IO array            */
  58. int        NSave_IO_E = 0;    /* Number of entries in Save IO array    */
  59. int        MSave_IO_E = 0;    /* Max Number of entries in SSave_IO    */
  60. S_SubShell    *SubShells;    /* Save Vars array            */
  61. int        NSubShells = 0;    /* Number of entries in SubShells    */
  62. int        MSubShells = 0;    /* Max Number of entries in SubShells    */
  63.  
  64. Word_B        *wdlist;    /* Current Word List            */
  65. Word_B        *iolist;    /* Current IO List            */
  66. long        ourtrap = 0L;    /* Signal detected            */
  67. int        trapset;    /* Trap pending                */
  68. int        yynerrs;    /* yacc errors detected            */
  69. int        Execute_stack_depth;    /* execute function recursion    */
  70.                     /* depth            */
  71. Var_List    *vlist = (Var_List *)NULL;    /* dictionary        */
  72. Var_List    *path;        /* search path for commands        */
  73. Var_List    *ps1;        /* Prompt 1                */
  74. Var_List    *ps2;        /* Prompt 2                */
  75. Var_List    *C_dir;        /* Current directory            */
  76. char        *last_prompt;    /* Last prompt output            */
  77. Var_List    *ifs;        /* Inter-field separator        */
  78. char        *home = "HOME";
  79. char        *shell = "SHELL";
  80. char        *history_file = "HISTFILE";
  81. char        *hsymbol = "#";
  82. char        *msymbol = "-";
  83. char        *spcl2 = "$`'\"";
  84.  
  85.                 /* I/O stacks                */
  86. IO_Args        ioargstack[NPUSH];
  87. IO_State    iostack[NPUSH];
  88.  
  89.                 /* Temporary I/O argument        */
  90. IO_Args        temparg = {
  91.     (char *)NULL,        /* Word                    */
  92.     (char **)NULL,        /* Word list                */
  93.     0,                /* File descriptor            */
  94.     AFID_NOBUF,            /* Buffer id                */
  95.     0L,                /* File position            */
  96.     (IO_Buf *)NULL        /* Buffer                */
  97. };
  98.  
  99. int        areanum;    /* Current allocation area        */
  100. int        inparse;    /* In parser flag            */
  101. long        flags = 0L;    /* Command line flags            */
  102. char        *null = "";
  103.  
  104.                 /* Current environment            */
  105. Environ    e = {
  106.     (char *)NULL,        /* Current line buffer            */
  107.     (char *)NULL,        /* Current pointer in line        */
  108.     (char *)NULL,        /* End of line pointer            */
  109.     iostack,            /* I/O Stack pointers            */
  110.     iostack - 1,
  111.     (int *)NULL,
  112.     FDBASE,            /* Base file handler            */
  113.     (Environ *)NULL        /* Previous Env pointer            */
  114. };
  115.